public class Fibonacci {
    public static int fib(int n) {
        if (n <= 1) return n;
        else return fib(n-1) + fib(n-2);
    }

    public static void main(String[] args) {
		System.out.println("Starting test fibonacci of 20");
        int N = 20;
        int f = fib(N);
		System.out.println("Expecxt 6765");
		System.out.println(f);
		
		System.out.println("Start iterative fibonacci of 5000");
		System.out.println(itrfib(5000));
    }
	
	public static int itrfib(int n)
	{
		int u = 0;
		int v = 1;
		int i, t;
			
		for(i = 2; i <= n; i++)
		{
			t = u + v;
			u = v;
			v = t;
		}
		return v;
	}
		
}